<div class="breadcrumb">
    <ul id="breadcrumb">
        <li><a href="<?php echo Configure::read('base_url');?>backstage" title="Home">
		<?php echo $this->Html->image("home.png", array("alt" => "Home",'class'=>'home','border'=>'0'));?>
		</a></li>
        <li><a href="<?php echo Configure::read('base_url');?>backstage/products/ptrack_disapproved" title="product tracking">Products Tracking - Disapproved</a></li>
        
    </ul>
</div>
<?php echo $this->element('admin/admin_leftmenu'); ?>
<div id="left">
    <?php
    echo $this->Session->flash();
    if ($this->Session->check('Message.auth'))
        echo $this->Session->flash('auth');
    ?>
    <div class="div_header"><?php __('Products Tracking - Disapproved'); ?></div>
    <div class="div_content">
        <div class="paging">
            <?php echo $this->element('admin/product/top_menu'); ?>
	</div>
        <div >
            <div  style="width:690px; background:  #ccc; margin-top: 5px; padding: 5px;color: black;">Search</div>
             <div >
           <form method="post" id="searchfrm" action="<?php echo Configure::read('base_url')."backstage/products/ptrack_disapproved"; ?>">
<table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td  style="border:0px;text-align: right;">Search By:</td><td   style="border:0px; width: 50px; text-align: left;">
        <input type="text" size="36"  id="serchkey" name="serchkey" class="anyOnerequired" title="Please enter keyword." value="Enter Product Item #, Title or Seller ID" onfocus="if(this.value=='Enter Product Item #, Title or Seller ID'){this.value=''}" onblur="if(this.value==''){this.value='Enter Product Item #, Title or Seller ID'}"/>
</td><td  style="border:0px;"><select name="data[type]">
    <option value="item">Item #</option>
    <option value="title">Title</option>
    <option value="sellerid">Seller ID</option>
</select><input type="submit" style="background:#73AE0B;
color:#fff; font-size:14px;" name="button" id="button" value="Search" />
</td>
</tr>
</table>
</form>
  <div id='message_success'></div>
         </div>
            </div>
           <table id="category_table" cellspacing="0" class="tablesorter">
            <thead>
               <tr style="background:gray;">
			
			<th>&nbsp;</th>
			<th>Item #</th>
			<th>Title</th>
			<th>Seller</th>
			<th>Status</th>
                        <th>Disapproval Date</th>
                        <th>Disapproved By</th>
			<th class="actions"><?php __('Actions');?></th>
	</tr>
            </thead>
            <tbody>
                <?php
               $i = 0;
               //pr($products);
               if(!empty ($products)){
                foreach ($products as $product):
                    $class = null;
                    if ($i++ % 2 == 0) 
                    $class = ' class="alt"';
                    
                ?>
                                  
                    <tr class="fullrow<?php echo $product['Product']['id']; ?>">
                         
                    <td <?php echo $class;?>  style="vertical-align: middle;">
					<?php echo'<img src="'.Configure::read('base_url').'img/uploads/'.$product['Product']['products_thumbnailImage'].'" alt="'.$product['Product']['products_title'].'" width="80" border="0" />';?>
					</td>
                    <td <?php echo $class;?>  style="vertical-align: middle;">
                     <?php echo $product['Product']['id']; ?>
                    </td>
                    <td  <?php echo $class;?>  style="vertical-align: middle;"><?php echo $product['Product']['products_title']; ?></td>
                    <td <?php echo $class;?>  style="vertical-align: middle;"><?php echo $product['User']['username']; ?></td>
                    <td <?php echo $class;?> style="vertical-align: middle;"> <?php echo $product['Product']['products_status']; ?></td>
                    <td <?php echo $class;?> style="vertical-align: middle;">
                     <?php echo date('d/m/Y',  strtotime($product['Product']['disapproved_date'])); ?>
                    </td>
                    <td  <?php echo $class;?> style="vertical-align: middle;"> <?php echo $product['Approver']['username']; ?></td>
        <td align="center"  <?php echo $class;?> style="vertical-align: middle;">
          <?php if($session->read('grouptype')=='S-Admins'){?>
            <a href="javascript:void(0);" controller="products" action="view_comment" title="messagebyitem"
               ElmID="<?php echo $product['Product']['id']; ?>" onclick='showPop(this)'>
            <input type="button" value="Comments" /></a>
            <?php
          }else{
            ?>
 <a href="javascript:void(0);" controller="messages" action="messagebyitem" title="messagebyitem"
               ElmID="<?php echo $product['Product']['id']; ?>" onclick='showPop(this)'>
            <input type="button" value="Messages" /></a>
             <?php
          }
            ?>
        </td>

                </tr>
               
        <?php
        $comments = $this->requestAction('/products/getnote/'.$product['Product']['id'].'/'.$product['Product']['user_id'].'/'.'1');
        //pr($comments);
        if(!empty ($comments)){
?>
       <tr    class="fullrow<?php echo $product['Product']['id']; ?>">
            <td colspan="8" id="disnote<?php echo $product['Product']['id']; ?>" style="background: none repeat scroll 0pt 0pt BlanchedAlmond;">
    <?php
        
        foreach($comments as $comment) {
        echo '<b>'.$comment['User']['username'].' [ '.date('d-m-Y g:i A',  strtotime($comment['Note']['created'])).' ] : </b> '.$comment['Note']['note'];echo"<br/>";
        //$j++;

        }
?>
</td></tr>
        <?php

        }
        ?>
<?php
endforeach;
               }else{
                   ?>
       <tr>
         <td colspan="8">
             No Disapproved Product Found.
          </td>
        </tr>
       <?php
               }
?>
                    <tbody>
                </table>
        <div class="paging">
            	<?php
                if($type!=null){
                $paginator->options(array('url' => "$serchkey/$type"));
                }
                echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
            </div>
            <div class="div_bottom"></div>
        </div>

        <!-- edit sidebar items here -->

        </div>

<?php echo $html->script(array("jquery.pagination.js", "jquery.tablesorter.min.js", "jquery.tablednd.js","jquery.validate.js")); ?>
<script type="text/javascript"> 
 
    jQuery(document).ready(function(){

        jQuery("#category_table").tablesorter({headers: {0:{sorter: false},7:{sorter: false}, 4:{sorter: false}}});

        jQuery.validator.addMethod("anyOnerequired", function (value, element) {
             var serchkey=jQuery("#serchkey").val();

          if(serchkey=='' || serchkey=='Enter Product Item #, Title or Seller ID'){return false;}else{return true;}


    }, "This field is required.");

 var v = jQuery("#searchfrm").validate({

                       });

                /////////////End////////////////////
                /*jQuery(".end").click(function()
        			{
                           var pid=jQuery(this).attr('id');
                                jQuery.ajax({
                                url : "<?php //echo Configure::read('base_url'); ?>products/pdisapproved/"+pid,
                                        success : function (html) {
                                            
                                             jQuery('.fullrow'+pid).remove();
                                            }
                                            });
                               /* jQuery('#message_success').html('Message deleted successfully.');
                                jQuery('#message_success').addClass('msg_success');
                                jQuery("#message_success").show();
                                jQuery("#message_success").animate({ top: "0px"}, 1000 ).fadeOut(1000);*/
                                       
                               //});*/


 });
</script>